#!/usr/bin/env python

import meson, time

def on_message(msg, ident):
    print 'Received:', msg, ident
    time.sleep(1)
    meson.send('Echo of ' + msg, ident)
    meson.send('Echo of ' + msg, ident)
    time.sleep(1)
    meson.send('Echo of ' + msg, ident)
    meson.send('Echo of ' + msg, ident)

def main():
    meson.init(('', 10061))
    meson.receive(None, on_message)
    meson.run()

if __name__ == '__main__':
    main()
